<template>
  <monitor-page
    ref="monitor"
    type="energyMonitor"
    :queryFormItem="collapseFormItem"
    :collapseFormItem="collapseFormItem"
    @handleSearch="handleSearch"
    :sourceData="sourceData"
  />
</template>

<script>
import monitorPage from "../components/costEquAnalysis.vue";
import { typeClassName } from "@/pages/config/classNameMap";
import mixin from "@/pages/components/mixins/mixin";
import { myRequest } from "public/service/api/myRequest";
export default {
  components: { monitorPage },
  mixins: [mixin],

  computed: {
    collapseFormItem() {
      return [
        {
          key: "equId",
          title: {
            "zh-CN": "设备",
            "en-US": "equId",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          config: {
            type: "select",
            options: this.equOptions,
            filterable: true,
          },
        },
        {
          key: "timeRange",
          title: {
            "zh-CN": "时间区间",
            "en-US": "timeRange",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          config: { type: "datetimeRange" },
        },
      ];
    },
  },
  data() {
    return {
      queryFormItems: [],
      collapseFormItems: [],
      typeOptions: [],
      equOptions: [],
      equipOptions: [],
      pointOptions: [],
      typeClassObject: null, // 能源类型实例
      sourceData: {
        startTime: "2023-12-01 00:00:00",
        endTime: "2023-12-08 23:59:59",
        type: "energy",
        equId: "4654",
        groupKey: "typeName",
        sumKey: "actual_cost",
      },
    };
  },
  created() {
    this.getEqu();
  },
  methods: {
    getEqu() {
      myRequest({
        url: "/star4.0/energy/queryEquipmentOptions",
        method: "post",
      }).then((res) => {
        this.$set(this, "equOptions", res);
      });
    },
  },
};
</script>

<style scoped lang="scss"></style>
